<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>防抖节流</title>
    <link href="index.css" rel="stylesheet">
</head>
<body>
<button class="btn" id="btn1">
    <span>防抖提交</span>
</button>
<button class="btn" id="btn2">
    <span>节流提交</span>
</button>

</body>
<script src="./03debounce.js"></script>
<script>
    function click1() {
        alert('btn1防抖提交')
    }

    function click2() {
        alert('btn2节流提交')
    }

    var btn1 = document.querySelector('#btn1')
    var btn2 = document.querySelector('#btn2')

    btn1.addEventListener('click', Debounce(click1, 2000))
    btn2.addEventListener('click', Throttle(click2, 2000))
</script>
</html>

